home *** CD-ROM | disk | FTP | other *** search
- Listing 1. Timer Package Macro Assembly Definitions.
-
- ;*** SysAllocateTimer - Allocate a Timer Object.
- ;
- ; This macro is used to allocate a timer object
- ; and initialize its context and expiration
- ; routine parameters.
- ;
- ; Usage: SysAllocateTimer timer, context, expiration_rtn
-
- SysAllocateTimer MACRO tmr, ctx, exprtn
- push ax
- push bx
- push cx
- push dx
- mov ax, ctx ; (AX) = timer routine context.
- mov bx, cs ; (BX) = seg FWA, expiration rtn.
- mov cx, exprtn ; (CX) = ofs FWA, expiration rtn.
- Pcall AllocateTimer
- pop dx
- pop cx
- pop bx
- mov tmr, ax ; store handle to timer object.
- pop ax
- ENDM
-
- ;*** SysDeallocateTimer - Free a Timer Object.
- ;
- ; This macro is used to deallocate a timer object
- ; and return it to the system.
- ;
- ; Usage: SysDeallocateTimer timer
-
- SysDeallocateTimer MACRO tmr
- push ax
- push dx
- mov ax, tmr ; (AX) = handle to timer object.
- Pcall DeallocateTimer
- pop dx
- pop ax
- ENDM
-
- ;*** SysStartTimer - Start a Timer Object.
- ;
- ; This macro is used to start a timer object
- ; and specify the number of milliseconds before
- ; the expiration routine should be executed.
- ;
- ; Usage: SysStartTimer timer, deltatime
-
- SysStartTimer MACRO tmr, delta
- push ax
- push cx
- push dx
- mov ax, tmr ; (AX) = handle to timer object.
- mov cx, delta ; (CX) = ms until timer shall expire.
- Pcall StartTimer
- pop dx
- pop cx
- pop ax
- ENDM
-
- ;*** SysStopTimer - Stop a Timer Object.
- ;
- ; This macro is used to stop a timer object.
- ;
- ; Usage: SysStopTimer timer
-
- SysStopTimer MACRO tmr
- push ax
- push dx
- mov ax, tmr ; (AX) = handle to timer object.
- Pcall StopTimer
- pop dx
- pop ax
- ENDM
-